package org.example.DesignPatterns.Composite;

import java.util.ArrayList;
import java.util.List;

/**
 * @description: \
 * @author: farprt
 * @create: 2022-09-18 13:11
 **/
public class Folder extends Node{

    private List<Node> childrenNodes=new ArrayList<>();

    public Folder(String name) {
        super(name);
    }

    @Override
    protected void add(Node child) {
        childrenNodes.add(child);
    }

    @Override
    protected void tree(int space) {
        super.tree(space);
        space++;
        for(Node node:childrenNodes){
            node.tree(space);
        }
    }
}